#include "Disk.h"

/***************The YAM Disk *********************************/
static struct Sector Disk[SIZEOFDISK];





/***
 *	Read one sector  at sector position "index" into user memory 
 *      @param sector position (starts with 0)
 *      @param address in user memory
 **/

int readSector(int index,struct Sector * theSector)
{
  int t;

  if((index < 0) || (index >= (SIZEOFDISK)) )
    return(-1);

  for(t=0;t<SIZEOFSECTOR;++t)
    theSector->byte[t] = Disk[index].byte[t];

  return(0);
}










/***
 *      Write one sector at sector position "index" 
 *      512 bytes are moved from user memory to that sector 
 *      @param sector position to write (starts with 0)
 *      @param address in user memory
 **/

int writeSector(int index,  struct Sector *  theSector)
{
  int t;

  if(  (index < 0) || (index >= (SIZEOFDISK) ) )
    return(-1);

  for(t=0;t<SIZEOFSECTOR;++t)
    Disk[index].byte[t] = theSector->byte[t];

  return(0);
}







int numberOfSectorsOnDisk()
{
  return SIZEOFDISK;
}

